#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.device.feign.service.failback;

import lombok.extern.slf4j.Slf4j;
import ${package}.device.feign.service.GateWayFeignService;
import ${package}.device.feign.entity.DeviceBaseDTO;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;

/**
 * @version: 1.00.00
 * @description: IOT3.0feign调用分组组件类熔断
 * @copyright: Copyright (c) 2020 立林科技 All Rights Reserved
 * @company: 厦门立林科技有限公司
 * @author: youxiaojuan
 * @date: 2020-3-11 16:00:26
 */
@Component
@Slf4j
public class GateWayFeignServiceHystrix implements FallbackFactory<GateWayFeignService> {


    @Override
    public GateWayFeignService create(Throwable cause) {
        log.error("iot-gateway fallback; reason was:{}", cause.getMessage());
        log.error("FeignGatewayServiceHystrix.create " + Thread.currentThread().getThreadGroup() + " - " + Thread.currentThread().getId() + " - " + Thread.currentThread().getName());
        return new GateWayFeignService() {
            @Override
            public List<DeviceBaseDTO> getGroupDeviceBase(Long groupId) {
                return Collections.emptyList();
            }
        };
    }

}
